<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
    <style>
        .box {
            width: 400px;
            height: 400px;
            border: 1px solid #000;
        }
        
        .item1,
        .item2,
        .item3,
        .item4,
        h1 {
            width: 300px;
            margin: 20px auto;
        }
        
        h1 {
            margin-top: 50px;
        }
    </style>
</head>

<body>
    <div id="box">
        <h1>简单计算器</h1>
        <div class="item1">
            <span>数值A：</span>
            <input type="text" v-model="t1" />
        </div>
        <div class="item2">
            <span>数值B：</span>
            <input type="text" v-model="t2" />
        </div>
        <div class="item3">
            <input type="button" value="计算" @click="handle" />
        </div>
        <div class="item4">
            <span>计算结果</span>
            <a href="javascript:void(0)">{{result}}</a>
        </div>
    </div>
    <script>
        var vm = new Vue({
            el: '#box',
            data: {
                t1: '',
                t2: '',
                result: ''
            },
            methods: {
                handle() {
                    this.result = parseInt(this.t1) + parseInt(this.t2);
                }
            }
        })
    </script>
</body>

</html>